package com.tengju.user.domain.model.sign;

import java.util.Arrays;

public enum StarsIndicatorConfCodeEnum {

    CITY_STAR_ONE(10, "CITY_STAR_ONE_INDICATOR_LIMIT", "城市一星指标配置code"),
    CITY_STAR_TWO(20, "CITY_STAR_TWO_INDICATOR_LIMIT", "城市二星指标配置code"),
    CITY_STAR_THREE(30, "CITY_STAR_THREE_INDICATOR_LIMIT", "城市三星指标配置code"),
    CITY_STAR_FOUR(40, "CITY_STAR_FOUR_INDICATOR_LIMIT", "城市四星指标配置code"),
    EC(50, "EC_STAR_INDICATOR_LIMIT", "EC指标配置code"),
    SEC(60, "SEC_STAR_SIX_INDICATOR_LIMIT", "SEC指标配置code"),
    EEC(70, "EEC_STAR_FOUR_INDICATOR_LIMIT", "EEC指标配置code");

    private Integer starLevel;
    private String code;
    private String desc;

    private StarsIndicatorConfCodeEnum(Integer starLevel, String code, String desc) {
        this.starLevel = starLevel;
        this.code = code;
        this.desc = desc;
    }

    public Integer getStarLevel() {
        return starLevel;
    }
    
    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
    
    public static StarsIndicatorConfCodeEnum getByStarLevel(Integer starLevel) {
        return Arrays.stream(StarsIndicatorConfCodeEnum.values()).filter(k->k.getStarLevel().equals(starLevel))
        .findFirst().orElse(null);
    }

    public static StarsIndicatorConfCodeEnum getByCode(String confCode) {
        return Arrays.stream(StarsIndicatorConfCodeEnum.values()).filter(k->k.getCode().equals(confCode))
        .findFirst().orElse(null);
    }

}
